import java.util.Arrays;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86136
 * Date: 2024-05-18
 * Time: 19:51
 */
public class TestDomo {
    public static void main(String[] args) {
        //java当中二维数组不可以省略行
        int[][] array = new int[2][];//不规则二维数组
        array[0] = new int[]{1,2,3};
        array[1] = new  int[4];
        System.out.println(Arrays.deepToString(array));
    }
    public static boolean fuc(int[] array) {
        int count = 0;
        for (int i = 0; i < array.length; i++) {
            if (array[i] % 2 != 0) {
                count++;
                while(count == 3) {
                    return true;
                }
            }else {
                count = 0;
            }
        }
        return false;
    }
    public static void main2(String[] args) {
        int[] array = {1,3,2,4,5,4,5,27};
        boolean ret = fuc(array);
        System.out.println(ret);
    }
    public static void exchange(int[] array) {
        int left = 0;
        int right = array.length-1;
        while(left < right) {
            while(left < right && array[left] % 2 != 0){
                left++;
            }
            while(left < right && array[right] % 2 == 0){
                right--;
            }
            swap(array,left,right);
        }
    }
    public static void swap(int[] array,int i,int j) {
        int tmp = array[i];
        array[i] = array[j];
        array[j] = tmp;
    }
    public static void main1(String[] args) {
        int[] array = {1,2,3,4,5,6};
        exchange(array);
        System.out.println(Arrays.toString(array));
    }
}
